﻿#if UNITY_EDITOR
using UnityEditor;
#endif
using System;
using UnityEngine;
using Random = UnityEngine.Random;

namespace MyFramework
{
    public partial class MathUtil
    {
        /// <summary>
        /// 输入百分比判断是否在范围中
        /// </summary>
        /// <param name="percent"></param>
        /// <returns>false = 不在指定范围中 ; true = 在指定范围中</returns>
        public static bool RandFunction(int percent)
        {
            return  Random.Range(0, 100)<=percent;
        }
        /// <summary>
        /// 随机输出一个输入数组中的值
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="values"></param>
        /// <returns></returns>
        public static T GetRandomValueFrom<T>(params T[] values)
        {
            return values[Random.Range(0, values.Length)];
        }

    }
}
